package mysql

import (
	"gorm.io/gorm"
	"yukao1/models/global"
	"yukao1/models/request"
)

// 订单详情
type OrderDetailYk struct {
	gorm.Model
	GoodsId    int     `gorm:"type:int(10);comment:商品id;"`
	GoodsName  string  `gorm:"type:varchar(30);comment:商品名称;"`   //购买时候的名称
	GoodsPrice float64 `gorm:"type:decimal(10,2);comment:商品价格;"` //购买时候的价格
	Num        int     `gorm:"type:int(10);comment:购买数量;"`
}

func GetOrderByGoodsName(data request.KeywordOrdersList) []OrderDetailYk {
	var order []OrderDetailYk
	global.DB.Where("goods_name like ?", "%"+data.Keyword+"%").Find(&order)
	return order
}
